package cn.cau.epidemicsurveysystem.bean;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;

@Entity
@Table(name = "knowledge", schema = "gp2022", catalog = "")
public class KnowledgeBean {
    private int knowledgeId;
    private String knowledgeTitle;
    private String knowledgeKeyword;
    private String knowledgeText;
    private Date publishedTime;
    private String publisher;

    @Id
    @Column(name = "knowledgeId")
    public int getKnowledgeId() {
        return knowledgeId;
    }

    public void setKnowledgeId(int knowledgeId) {
        this.knowledgeId = knowledgeId;
    }

    @Basic
    @Column(name = "knowledgeTitle")
    public String getKnowledgeTitle() {
        return knowledgeTitle;
    }

    public void setKnowledgeTitle(String knowledgeTitle) {
        this.knowledgeTitle = knowledgeTitle;
    }

    @Basic
    @Column(name = "knowledgeKeyword")
    public String getKnowledgeKeyword() {
        return knowledgeKeyword;
    }

    public void setKnowledgeKeyword(String knowledgeKeyword) {
        this.knowledgeKeyword = knowledgeKeyword;
    }

    @Basic
    @Column(name = "knowledgeText")
    public String getKnowledgeText() {
        return knowledgeText;
    }

    public void setKnowledgeText(String knowledgeText) {
        this.knowledgeText = knowledgeText;
    }

    @Basic
    @Column(name = "publishedTime")
    public Date getPublishedTime() {
        return publishedTime;
    }

    public void setPublishedTime(Date publishedTime) {
        this.publishedTime = publishedTime;
    }

    @Basic
    @Column(name = "publisher")
    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        KnowledgeBean that = (KnowledgeBean) o;

        if (knowledgeId != that.knowledgeId) return false;
        if (knowledgeTitle != null ? !knowledgeTitle.equals(that.knowledgeTitle) : that.knowledgeTitle != null)
            return false;
        if (knowledgeKeyword != null ? !knowledgeKeyword.equals(that.knowledgeKeyword) : that.knowledgeKeyword != null)
            return false;
        if (knowledgeText != null ? !knowledgeText.equals(that.knowledgeText) : that.knowledgeText != null)
            return false;
        if (publishedTime != null ? !publishedTime.equals(that.publishedTime) : that.publishedTime != null)
            return false;
        if (publisher != null ? !publisher.equals(that.publisher) : that.publisher != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = knowledgeId;
        result = 31 * result + (knowledgeTitle != null ? knowledgeTitle.hashCode() : 0);
        result = 31 * result + (knowledgeKeyword != null ? knowledgeKeyword.hashCode() : 0);
        result = 31 * result + (knowledgeText != null ? knowledgeText.hashCode() : 0);
        result = 31 * result + (publishedTime != null ? publishedTime.hashCode() : 0);
        result = 31 * result + (publisher != null ? publisher.hashCode() : 0);
        return result;
    }
}
